package com.mzj.saas.rent;

import com.haixiaoke.saas.repository.core.AjaxResult;
import com.haixiaoke.saas.repository.core.BaseController;
import com.haixiaoke.saas.repository.core.page.TableDataInfo;
import com.haixiaoke.saas.repository.dto.HousingAllocationDTO;
import com.haixiaoke.saas.repository.service.IHouseService;
import com.haixiaoke.saas.repository.vo.HousingAllocationVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 房屋表saas_houseController
 *
 * @author haixiaoke
 * @date 2023-04-10
 */
@RestController
@RequestMapping("/saas-repository/house/apartment")
public class HouseApartmentController extends BaseController {
    @Autowired
    private IHouseService houseService;

    /**
     * 查询房屋列表
     */
    @GetMapping("/list")
    public TableDataInfo list(HousingAllocationDTO house) {
        startPage();
        List<HousingAllocationVO> list = houseService.selectHouseListApplet(house);
        return getDataTable(list);
    }

    /**
     * 统计公寓房屋上下架数量
     *
     */
    @GetMapping(value = "/countNum")
    public AjaxResult getCount() {
        return success(houseService.selectCount());
    }

}
